﻿<Window x:Class="TextBlock.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" >
    <Grid xmlns:sys="clr-namespace:System;assembly=mscorlib">
        <Grid.Resources>
            <ObjectDataProvider MethodName="GetType" 
                ObjectType="{x:Type sys:Type}" x:Key="colorsTypeOdp">
                <ObjectDataProvider.MethodParameters>
                    <sys:String>System.Windows.Media.Colors, PresentationCore,
                    Version=3.0.0.0, Culture=neutral, 
                    PublicKeyToken=31bf3856ad364e35</sys:String>
                </ObjectDataProvider.MethodParameters>
            </ObjectDataProvider>
            <ObjectDataProvider ObjectInstance="{StaticResource colorsTypeOdp}"  
                MethodName="GetProperties" x:Key="colorPropertiesOdp">
            </ObjectDataProvider>
        </Grid.Resources>
        <TextBlock Text="{Binding ElementName=textToCopyTxt, Path=Text, UpdateSourceTrigger=PropertyChanged}" Height="23" 
                   HorizontalAlignment="Left" Margin="12,9,0,0" Name="myTextBlock" VerticalAlignment="Top" Width="223" 
                   Foreground="{Binding ElementName=foregroungCB, Path=SelectedValue}"
                   Background="{Binding ElementName=backgroundCB, Path=SelectedValue}"/>
        <TextBox Height="23" HorizontalAlignment="Right" Margin="0,9,12,0" Name="textToCopyTxt" VerticalAlignment="Top" Width="210" />
        <ComboBox Name="foregroungCB" Width="130" Height="23"
            SelectedIndex="7"
            ItemsSource="{Binding Source={StaticResource colorPropertiesOdp}}"
            DisplayMemberPath="Name"
            SelectedValuePath="Name" Margin="45,180,328,108" />
        <ComboBox DisplayMemberPath="Name" Height="23" ItemsSource="{Binding Source={StaticResource colorPropertiesOdp}}" Margin="245,180,128,108" Name="backgroundCB" SelectedValuePath="Name" Width="130" />
        <Label Content="Foreground:" Height="28" HorizontalAlignment="Left" Margin="45,146,0,0" Name="label1" VerticalAlignment="Top" />
        <Label Content="BackGround:" Height="28" HorizontalAlignment="Left" Margin="245,146,0,0" Name="label2" VerticalAlignment="Top" />
    </Grid>
</Window>
